package kiv.janecekz;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPref {
    public final static String PREFS_NAME = "prefs";

    public static boolean getNotify(Context context) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        return prefs.getBoolean(context.getString(R.string.pref_key_notify),
                true);
    }

    public static boolean getOrient(Context context) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        return prefs.getBoolean(
                context.getString(R.string.pref_key_orientation), true);
    }

    public static int getTheme(Context context) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        return Integer.parseInt(prefs.getString(
                context.getString(R.string.pref_key_bg), "2"));
    }

    public static int getSound(Context context) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        return Integer.parseInt(prefs.getString(
                context.getString(R.string.pref_key_sound), "0"));
    }

    public static int getBPM(Context context) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        return prefs.getInt("bpm", 80);
    }

    public static void setBPM(Context context, int value) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        SharedPreferences.Editor edit = prefs.edit();
        edit.putInt("bpm", value);
        edit.commit();
    }

    public static int getTime(Context context) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        return prefs.getInt("time", 1);
    }

    public static void setTime(Context context, int value) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        SharedPreferences.Editor edit = prefs.edit();
        edit.putInt("time", value);
        edit.commit();
    }

    public static boolean getPlay(Context context) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        return prefs.getBoolean("play", false);
    }

    public static void setPlay(Context context, boolean value) {
        SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
        SharedPreferences.Editor edit = prefs.edit();
        edit.putBoolean("play", value);
        edit.commit();
    }
}
